;; 比较运算符测试脚本
;; 测试 >, <, =, >=, <= 运算符

(display "=== 比较运算符测试 ===")
(newline)

;; 基本比较运算测试
(display "\n1. 基本比较运算测试:")
(newline)
(display "(> 5 3): ")
(display (> 5 3))
(newline)
(display "(< 3 5): ")
(display (< 3 5))
(newline)
(display "(= 5 5): ")
(display (= 5 5))
(newline)
(display "(>= 5 5): ")
(display (>= 5 5))
(newline)
(display "(<= 5 5): ")
(display (<= 5 5))
(newline)
(display "(> 3 5): ")
(display (> 3 5))
(newline)
(display "(< 5 3): ")
(display (< 5 3))
(newline)
(display "(= 5 3): ")
(display (= 5 3))
(newline)
(display "(>= 3 5): ")
(display (>= 3 5))
(newline)
(display "(<= 5 3): ")
(display (<= 5 3))
(newline)

;; 负数比较测试
(display "\n2. 负数比较测试:")
(newline)
(display "(> -3 -5): ")
(display (> -3 -5))
(newline)
(display "(< -5 -3): ")
(display (< -5 -3))
(newline)
(display "(= -5 -5): ")
(display (= -5 -5))
(newline)
(display "(>= -3 -3): ")
(display (>= -3 -3))
(newline)
(display "(<= -5 -5): ")
(display (<= -5 -5))
(newline)

;; R4RS 标准说明
(display "\n3. R4RS 标准说明：")
(newline)
(display "根据 R4RS 标准，= 运算符只能用于数值比较。")
(newline)
(display "尝试比较字符串将抛出类型错误。")
(newline)

;; 链式比较测试
(display "\n4. 链式比较测试:")
(newline)
(display "(> 5 3 1): ")
(display (> 5 3 1))
(newline)
(display "(< 1 3 5): ")
(display (< 1 3 5))
(newline)
(display "(= 5 5 5): ")
(display (= 5 5 5))
(newline)
(display "(>= 5 5 3): ")
(display (>= 5 5 3))
(newline)
(display "(<= 1 3 3): ")
(display (<= 1 3 3))
(newline)

;; 与布尔运算符结合的测试
(display "\n5. 与布尔运算符结合的测试:")
(newline)
(display "(and (> 5 3) (< 3 10)): ")
(display (and (> 5 3) (< 3 10)))
(newline)
(display "(or (> 3 5) (< 3 10)): ")
(display (or (> 3 5) (< 3 10)))
(newline)
(display "(not (= 5 3)): ")
(display (not (= 5 3)))
(newline)

;; 与条件表达式结合的测试
(display "\n6. 与条件表达式结合的测试:")
(newline)
(display "(if (> 5 3) \"yes\" \"no\"): ")
(display (if (> 5 3) "yes" "no"))
(newline)
(display "(if (< 5 3) \"yes\" \"no\"): ")
(display (if (< 5 3) "yes" "no"))
(newline)
(display "(if (= 5 5) \"equal\" \"not equal\"): ")
(display (if (= 5 5) "equal" "not equal"))
(newline)

;; 变量绑定与比较运算
(display "\n7. 变量绑定与比较运算:")
(newline)
(let ((x 5) (y 3) (z 5))
  (display "(let ((x 5) (y 3) (z 5)) (> x y)): ")
  (display (> x y))
  (newline)
  (display "(let ((x 5) (y 3) (z 5)) (= x z)): ")
  (display (= x z))
  (newline)
  (display "(let ((x 5) (y 3) (z 5)) (<= y x)): ")
  (display (<= y x))
  (newline)
)

;; 错误测试已移除，因为它们会导致程序崩溃

(newline)
(display "\n所有测试完成！")
(newline)